package com.nanhang.client;

import com.nanhang.util.R;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

@Component
@Slf4j
public class UserClientFactory implements FallbackFactory<Userclient> {
    @Override
    public Userclient create(Throwable t) {
        return new Userclient() {
            @Override
            public R list() {
                log.info("访问用户列表失败，原因是：{}",t.getMessage());
                return R.error().message("访问用户列表失败(UserClientFactory)！");
            }
        };
    }
}
